﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Admin.CheckupForm
{
    public partial class PrintXYLook : System.Web.UI.Page
    {
        ChinaSoft.BLL.BLL_tb_MidSoft_CheckupForm bllCheckupForm = new ChinaSoft.BLL.BLL_tb_MidSoft_CheckupForm();
        ChinaSoft.Model.Model_tb_MidSoft_CheckupForm modelCheckupForm = new ChinaSoft.Model.Model_tb_MidSoft_CheckupForm();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["CheckupFormId"] != null && Request.Params["CheckupFormId"].Trim() != "")
            {
                int checkupFormId = ChinaSoft.Common.Input.SetInt(Request.Params["CheckupFormId"]);
                BindCheckupFormInfoData(checkupFormId);
            }
        }

        private void BindCheckupFormInfoData(int checkupformId)
        {
            modelCheckupForm = bllCheckupForm.GetModel(checkupformId);
            if(modelCheckupForm!=null)
                txtContent.Text = ChinaSoft.Common.Input.FilterStr(modelCheckupForm.CheckupContent);
        }

        protected void btSave_Click(object sender, EventArgs e)
        {
            if (Request.Params["CheckupFormId"] != null && Request.Params["CheckupFormId"].Trim() != "")
            {
                int checkupFormId = ChinaSoft.Common.Input.SetInt(Request.Params["CheckupFormId"]);
                modelCheckupForm = bllCheckupForm.GetModel(checkupFormId);
                modelCheckupForm.CheckupContent = ChinaSoft.Common.Input.FilterStr(txtContent.Text.Trim());
                bllCheckupForm.Update(modelCheckupForm);
                Response.Redirect("PrintXY.aspx?CheckupFormId=" + checkupFormId);
            }
        }
    }
}